<?php

/**

* Smarty plugin

* @package Smarty

* @subpackage plugins

*/

/**

* Smarty currency modifier plugin

*

* Type: modifier<br>

* Name: currency<br>

* Purpose: format number via currency

* @link http://smarty.php.net/manual/en/language.modifier.number.format.php

* @param string

* @param integer

* @param character

* @param character

* @return string

*/

function smarty_modifier_currency($number, $decimals="2", $decpoint=".", $thousandsep=",")
{
	if ($number < 0){
		$return = "($".number_format($number, $decimals, $decpoint, $thousandsep).")";
	}else{
		$return = "$".number_format($number, $decimals, $decpoint, $thousandsep);
	}
	return $return;
}

/* vim: set expandtab: */

?>
